#include "widget.h"
#include "ui_widget.h"
#include<unistd.h>

Widget::Widget(QWidget *parent)
    : QWidget(parent),thread(new Thread)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
   //  thread->start();
    //sleep(3);
    //thread->terminate();
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    if(thread->isFinished())
    {
        thread->set_choose(1);
        thread->start();
    }
    else
    {
        qDebug("上一个任务还没结束，无法启动新任务");
    }
}


void Widget::on_pushButton_2_clicked()
{
    if(thread->isFinished())
    {
        thread->set_choose(2);
        thread->start();
    }
    else
    {
        qDebug("上一个任务还么结束");
    }

}

